package org.noip.milhous.hierarchy;

import java.util.LinkedList;
import java.util.List;

import org.noip.milhous.clause.Where;

public class TableNode
{
	Where where;

	@SuppressWarnings("rawtypes")
	private Class className;

	List<TableNode> children;

	@SuppressWarnings("rawtypes")
	public TableNode(Class classtype)
		{
			setClassName(classtype);
			children = new LinkedList<TableNode>();
			where = null;
		}

	@SuppressWarnings("rawtypes")
	public TableNode(Class classtype, Where where)
		{
			children = new LinkedList<TableNode>();
			this.where = where;
			setClassName(classtype);
		}

	public void addChild(TableNode child)
		{
			children.add(child);
		}

	@SuppressWarnings("rawtypes")
	public void addChildren(Class... classes)
		{
			for (Class c : classes)
				{
					addChild(new TableNode(c));
				}
		}

	public Where getWhere()
		{
			return where;
		}

	@SuppressWarnings("rawtypes")
	private void setClassName(Class className)
		{
			this.className = className;
		}

	@SuppressWarnings("rawtypes")
	public Class getClassName()
		{
			return className;
		}

	public List<TableNode> getChildren()
		{
			return children;
		}
}
